﻿namespace CodingExercises._31_40;

public class ReverseString
{
    // 反转字符串
    public static string Method(string input)
    {
        if (input is null)
        {
            throw new ArgumentNullException(
                nameof(input), "Input cannot be null.");
        }

        var result = new char[input.Length];
        for (int i = 0; i < input.Length; i++)
        {
            result[i] = input[input.Length - 1 - i];
        }

        return new string(result);
    }
}